/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package WebServices;

import SessionBeans.ComisionFacade;
import SessionBeans.FacturaFacade;
import SessionBeans.ProveedorFacade;
import SessionBeans.ServicioFacade;
import entity.Comision;
import entity.Factura;
import entity.Proveedor;
import entity.Servicio;
import java.util.List;
import javax.ejb.EJB;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.ejb.Stateless;
import javax.jws.Oneway;

/**
 *
 * @author Administrador
 */
@WebService(serviceName = "AdministradorWS",wsdlLocation="META-INF/wsdl/AdministradorWS.wsdl")
@Stateless()
public class AdministradorWS {
    
    @EJB
    private ProveedorFacade ejbRefPro;
    @EJB
    private ComisionFacade ejbRefCom;
    
    @EJB
    private FacturaFacade ejbRefFactura;
    
    @EJB
    private ServicioFacade ejbRefSer;    
         
    @WebMethod(operationName = "createComision")
    @Oneway
    public void createComision(@WebParam(name = "entity")
    Comision entity) {
        ejbRefCom.create(entity);
    }

    @WebMethod(operationName = "editComision")
    @Oneway
    public void editComision(@WebParam(name = "entity")
    Comision entity) {
        ejbRefCom.edit(entity);
    }

    @WebMethod(operationName = "removeComision")
    @Oneway
    public void removeComision(@WebParam(name = "entity")
    Comision entity) {
        ejbRefCom.remove(entity);
    }

    @WebMethod(operationName = "findComision")
    public Comision findComision(@WebParam(name = "id")
    Object id) {
        return ejbRefCom.find(id);
    }
     @WebMethod(operationName = "findAllComision")
    public List<Comision> findAllComision() {
        return ejbRefCom.findAll();
    }
    @WebMethod(operationName = "removeFactura")
    @Oneway
    public void removeFactura(@WebParam(name = "entity")
    Factura entity) {
        ejbRefFactura.remove(entity);
    }

    @WebMethod(operationName = "findAllFactura")
    public List<Factura> findAllFactura() {
        return ejbRefFactura.findAll();
    }

    @WebMethod(operationName = "countFactura")
    public int countFactura() {
        return ejbRefFactura.count();
    }
    
    @WebMethod(operationName = "createProveedor")
    @Oneway
    public void createProveedor(@WebParam(name = "entity")
    Proveedor entity) {
        ejbRefPro.create(entity);
    }
    @WebMethod(operationName = "editProveedor")
    @Oneway
    public void editProveedor(@WebParam(name = "entity")
    Proveedor entity) {
        ejbRefPro.edit(entity);
    }

    @WebMethod(operationName = "removeProveedor")
    @Oneway
    public void removeProveedor(@WebParam(name = "entity")
    Proveedor entity) {
        ejbRefPro.remove(entity);
    }

    @WebMethod(operationName = "findProveedor")
    public Proveedor findProveedor(@WebParam(name = "id")
    Object id) {
        return ejbRefPro.find(id);
    }

    @WebMethod(operationName = "findAllProveedor")
    public List<Proveedor> findAllProveedor() {
        return ejbRefPro.findAll();
    }    

    @WebMethod(operationName = "findAllServicio")
    public List<Servicio> findAllServicio() {
        return ejbRefSer.findAll();
    }
     
}
